/**/
#include "duoji.h"
  
//DJ_ID_0: C ATCHER  //OPEN:75   //catch：90(circle)(long square)(squre) 85(circle huan)  //close 95
//DJ_ID_1: y GUI YAW   ZHENG DUI  //LEFT:110  //RIGHT:170
//DJ_ID_2: y GUI PITCH   //PING:115  //YANG:60
//DJ_ID_3: r OCKET YAW //INIT:130   //CATCH:70
	
	
void Duoj_Con(int16_t ang,uint8_t id)
{
	float tes=0;
	
	if(id==0){
		 tes=(ang*2)/9+10;
		__HAL_TIM_SET_COMPARE(&htim1,TIM_CHANNEL_1,tes);
	 }
	 
	if(id==1){
		tes=(ang*2)/9+10;
		__HAL_TIM_SET_COMPARE(&htim1,TIM_CHANNEL_2,tes);
	}
   if(id==2){
		 tes=(ang*2)/9+10;
		__HAL_TIM_SET_COMPARE(&htim1,TIM_CHANNEL_3,tes);
	 }
	 if(id==3){
		 tes=(ang*2)/9+10;
		__HAL_TIM_SET_COMPARE(&htim1,TIM_CHANNEL_4,tes);
	 }
	 if(id==4){
			tes=(ang*2)/27+5;
		__HAL_TIM_SET_COMPARE(&htim8,TIM_CHANNEL_1,(uint16_t)tes);
	 }
	 
	 decsss=tes;
   
    
}



void pwm_init(void)
{
	
	 HAL_TIM_Base_Start(&htim1);
	HAL_TIM_Base_Start(&htim8);
	HAL_TIM_PWM_Start(&htim1,TIM_CHANNEL_1);
   HAL_TIM_PWM_Start(&htim1,TIM_CHANNEL_2);
		HAL_TIM_PWM_Start(&htim1,TIM_CHANNEL_3);
	HAL_TIM_PWM_Start(&htim1,TIM_CHANNEL_4);
	HAL_TIM_PWM_Start(&htim8,TIM_CHANNEL_1);
}

/*占空比：
0.5%----0 CCC
1.0%---45
1.5%---90
2.0%--135
2.5%--180
*/
